package com.itheima.web.controller;

import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author huyoufu <https://github.com/huyoufu>
 * @TIME 2020-08-14 20:32
 * @description
 */
@RestControllerAdvice
public class MyControllerAdvice1 {

    @ExceptionHandler(ArithmeticException.class)
    @ResponseBody
    @ResponseStatus(HttpStatus.OK)
    public ResultVo catchException1(){
        System.out.println("出现除0异常!!!!");

        return new ResultVo(0,"出问题了");
    }

    @ExceptionHandler(RuntimeException.class)
    @ResponseBody
    //@ResponseStatus(HttpStatus.OK)
    public ResultVo catchException2(){


        return new ResultVo(0,"出问题了");
    }
}
